package leetcode.code1346;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Solution {
	public boolean checkIfExist(int[] arr) {
		Set<Integer> set = new HashSet<>();
		Arrays.sort(arr);
		for (int i = arr.length - 1; i >= 0; i--) {
			int num = arr[i];
			if (set.contains(num << 1) || ( num< 0 && (num & 1) == 0 && set.contains(num >> 1))) {
				return true;
			}
			set.add(num);
		}
		return false;
	}
}
